<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib tagdir="/WEB-INF/tags" prefix="tags"%>
<!DOCTYPE html>
<html lang="en">
<base href="/">
<head>
<title>${applicationScope.sysName}</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<link rel="stylesheet" href="static/style/adminLogin.css" />
<script type="text/javascript" src="static/js/jquery-1.9.1.js"></script>
</head>
<body>
	<form action="/admin/login" method="post" name="loginForm" id="form_login">
		<input type="hidden" id="hidden_remember_password">
		<input type="hidden" id="hidden_password">
		<div class="main">
			<div class="main_main">
				<div class="title">${applicationScope.sysName}</div>
				<div class="user">
					<img src="static/images/uuser.png" />
					<input class="enterLogin" type="text" name="username" id="ipt_loginname" placeholder="请输入登录名" maxlength="20" />
				</div>
				<div class="user">
					<img src="static/images/upwd.png" />
					<input class="enterLogin" type="password"  id="ipt_password" placeholder="请输入密码" maxlength="20" />
					<input type="hidden" name="password" id="hidden_password">
				</div>
				<div class="rememberPwd">
					<input id="ipt_remember_password" type="checkbox" />
					<label>记住密码</label>
				</div>
				<div class="login" onclick="login()">立即登录</div>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="static/js/jquery.tips.js"></script>
	<script type="text/javascript" src="static/js/jquery.cookie.js"></script>
	<script type="text/javascript" src="static/js/jquery.md5.js"></script>
	<script type="text/javascript" src="static/js/common/common.js"></script>
	<script type="text/javascript" src="static/js/common/commonTip.js"></script>
	<script>
		$(function() {
			var passwordCookie = $.cookie("ps");
			var loginnameCookie = $.cookie("pn");
			if (passwordCookie && loginnameCookie && passwordCookie != "null" && loginnameCookie != "null") {
				$("#ipt_loginname").val(loginnameCookie);
				$("#ipt_password").val("*****DeFAFA***");
				$("#hidden_password").val(passwordCookie);
				$("#hidden_remember_password").val("true");
				$("#ipt_remember_password").attr("checked", true);
			} else {
				$.cookie("ps", "", {
					expires : -1,
					path : '/admin'
				});
				$.cookie("pn", "", {
					expires : -1,
					path : '/admin'
				});
			}
			$("#ipt_password").change(function() {
				$("#hidden_remember_password").val("false");
			});

			$(".enterLogin").keypress(function(event) {
				if (event.keyCode == 13) {
					login();
				}
			});
		});
		//登录
		function login() {
			var password = $("#ipt_password").val();
			var loginname = $("#ipt_loginname").val();
			var isRememberPassword = $("#ipt_remember_password").is(":checked");
			var hiddenRememberPassword = $("#hidden_remember_password").val();
			var hiddenPassword = $("#hidden_password").val();
			var data = {};
			//检查参数
			if (!CommValidate.isNotNullStr(loginname)) {
				Tips.showError("ipt_loginname", "请输入登录名");
				return false;
			}
			if (!CommValidate.isNotNullStr(password)) {
				Tips.showError("ipt_password", "请输入登录密码");
				return false;
			}
			$("#hidden_password").val($.md5($("#ipt_password").val()));
			$("#form_login").submit();
			
		}
	</script>
	<script>
		//TOCMAT重启之后 点击左侧列表跳转登录首页 
		if (window != top) {
			top.location.href = location.href;
		}
	</script>
	<tags:loading></tags:loading>
</body>
</html>